/*    */ package eos.moe.dragoncore;
/*    */ 
/*    */ import java.awt.geom.AffineTransform;
/*    */ import java.awt.image.AffineTransformOp;
/*    */ import java.awt.image.BufferedImage;
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.nio.ByteBuffer;
/*    */ import javax.imageio.ImageIO;
/*    */ import net.minecraft.client.Minecraft;
/*    */ import net.minecraft.util.ResourceLocation;
/*    */ import org.lwjgl.BufferUtils;
/*    */ 
/*    */ 
/*    */ 
/*    */ public class cp
/*    */ {
/*    */   public static BufferedImage v(String a) throws IOException {
/* 19 */     InputStream inputStream = null;
/*    */     try {
/* 21 */       a = a.replaceAll("//", "/");
/* 22 */       inputStream = cp.class.getResourceAsStream(a);
/* 23 */       return ImageIO.read(inputStream);
/* 24 */     } catch (IOException iOException) {
/* 25 */       throw new IOException(String.format(g, new Object[] { "file", a }));
/*    */     } 
/*    */   }
/*    */   
/*    */   public static BufferedImage v(ResourceLocation a) throws IOException {
/*    */     try {
/* 31 */       InputStream inputStream = Minecraft.func_71410_x().func_110442_L().func_110536_a(a).func_110527_b();
/* 32 */       return ImageIO.read(inputStream);
/* 33 */     } catch (IOException iOException) {
/* 34 */       throw new IOException(String.format(g, new Object[] { "ResourceLocation", a }));
/*    */     } 
/*    */   }
/*    */   
/*    */   public static BufferedImage v(BufferedImage a, double d) {
/* 39 */     double d1 = a.getWidth() * 0.5D;
/* 40 */     double d2 = a.getHeight() * 0.5D;
/* 41 */     double d3 = Math.toRadians(d);
/* 42 */     AffineTransform affineTransform = new AffineTransform();
/* 43 */     affineTransform.rotate(d3, d1, d2);
/* 44 */     AffineTransformOp affineTransformOp = new AffineTransformOp(affineTransform, 1);
/* 45 */     return affineTransformOp.filter(a, (BufferedImage)null);
/*    */   }
/*    */   
/*    */   public static ByteBuffer v(BufferedImage a) {
/* 49 */     int i = a.getWidth();
/* 50 */     int j = a.getHeight();
/* 51 */     int[] arrayOfInt = new int[a.getWidth() * a.getHeight()];
/* 52 */     a.getRGB(0, 0, i, j, arrayOfInt, 0, i);
/* 53 */     ByteBuffer byteBuffer = BufferUtils.createByteBuffer(i * j * 4);
/* 54 */     for (int k = 0; k < j; k++) {
/* 55 */       for (int m = 0; m < i; m++) {
/* 56 */         int n = arrayOfInt[k * i + m];
/* 57 */         byteBuffer.put((byte)(n >> 16 & 0xFF));
/* 58 */         byteBuffer.put((byte)(n >> 8 & 0xFF));
/* 59 */         byteBuffer.put((byte)(n & 0xFF));
/* 60 */         byteBuffer.put((byte)(n >> 24 & 0xFF));
/*    */       } 
/*    */     } 
/* 63 */     byteBuffer.flip();
/* 64 */     byteBuffer.rewind();
/* 65 */     return byteBuffer;
/*    */   }
/*    */ 
/*    */   
/* 69 */   private static String g = "There was an error loading the %s \"%s\".";
/*    */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\eos\moe\dragoncore\cp.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */